home *** CD-ROM | disk | FTP | other *** search
- ' CITY.BAS
- ' This program stores a list of cities in a sequential file.
-
- OPEN "CITY.TXT" FOR OUTPUT AS #1 ' open file in current drive/dir
-
- CLS
-
- PRINT "This program stores city names on disk in a file named CITY.TXT."
- PRINT "Enter your favorite cities and type END to quit."
- PRINT
-
- DO WHILE (city$ <> "END") ' until user enters END
- INPUT " City name: ", city$ ' get names from user
- IF (city$ <> "END") THEN PRINT #1, city$ ' write names to file
- LOOP
-
- CLOSE #1 ' close file
-
- PRINT
- INPUT "Press Enter to see the cities you entered. ", dummy$
- PRINT
-
- OPEN "CITY.TXT" FOR INPUT AS #1 ' open file for input
-
- DO WHILE (NOT EOF(1)) ' until end of file is reached
- INPUT #1, city$ ' get names
- PRINT city$ ' print names
- LOOP
-
- CLOSE #1 ' close file
-
-